class ChinaGetter:
    def __init__(self):
        self.trans = dict(dog='小狗', cat='小猫')

    def get(self, msgid):
        return self.trans.get(msgid, str(msgid))


class EnglishGetter:
    def get(self, msgid):
        return str(msgid)


def get_localizer(language="English"):
    languages = dict(English=EnglishGetter, China=ChinaGetter)
    return languages[language]()


e, g = get_localizer("English"), get_localizer("China")

for msgid in "dog parrot cat bear".split():
    print(e.get(msgid), g.get(msgid))


class Person:
    def __init__(self):
        self.name = None
        self.gender = None

    def getName(self):
        return self.name

    def getGender(self):
        return self.gender


class Male(Person):
    def __init__(self, name, gender):
        super(Male, self).__init__()
        self.name = name
        self.gender = gender

    def show(self):
        print("Hello Mr," + self.name)


class Female(Person):
    def __init__(self, name, gender):
        super(Female, self).__init__()
        self.name = name
        self.gender = gender

    def show(self):
        print('Hello Miss,' + self.name)


class Factory:
    def getPerson(self, name, gender):
        if gender == 'M':
            return Male(name, gender)
        if gender == 'F':
            return Female(name, gender)


if __name__ == '__main__':
    factory = Factory()
    person = factory.getPerson("Chetan", "M")
    print(person.name)
    person.show()
